import hyRequest from "../..";
import { getCurrentToken } from "../login";
const token = getCurrentToken();
export const getIndexCharts = () => {
  return hyRequest.get({
    url: "/charts/getCharts",
    headers: {
      Authorization: `Bearer ${token}`,
    },
  });
};

/**
 * @获取留言列表
 */
export function getLeaveWordList(query: {
  pageNum?: number;
  pageSize?: number;
}) {
  return hyRequest.get({
    url: "/leaveWord/list",
    headers: {
      Authorization: `Bearer ${token}`,
    },
    params: query,
  });
}

/**
 * @删除留言
 */
export function deleteLeaveWord(id: number) {
  return hyRequest.delete({
    url: `/leaveWord/${id}`,
    headers: {
      Authorization: `Bearer ${token}`,
    },
  });
}

/**
 * @导出留言列表
 */

export function exportLeaveWord(query: { pageSize: number; pageNum: number }) {
  return hyRequest.post({
    url: "/leaveWord/export",
    headers: {
      Authorization: `Bearer ${token}`,
    },
    params: query,
    responseType: "blob",
  });
}
